package com.example.producer.controller;


//import org.springframework.amqp.core.AmqpTemplate;
import com.example.producer.service.DirectService;
import com.example.producer.service.ProducerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class ProducerController {

    @Autowired
    ProducerService producerService;

    @Autowired
    DirectService directService;


    //测试地址http://localhost:9902/sender/liaoliang
    @RequestMapping(value = "sender/{name}")
    public String send(@PathVariable String name) {
        if("test".equals(name)){
            directService.send(name);
        }else{
            producerService.send(name);
        }
        return new Date().toString();
    }
}